import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/entity/home/content/image_text_nav_entity.dart';
import 'package:cbec_app/entity/home/content/content_data.dart';

ImageTextNavEntity $ImageTextNavEntityFromJson(Map<String, dynamic> json) {
  final ImageTextNavEntity imageTextNavEntity = ImageTextNavEntity();
  final int? borderWidth = jsonConvert.convert<int>(json['border_width']);
  if (borderWidth != null) {
    imageTextNavEntity.borderWidth = borderWidth;
  }
  final String? showMethod = jsonConvert.convert<String>(json['show_method']);
  if (showMethod != null) {
    imageTextNavEntity.showMethod = showMethod;
  }
  final String? backgroundColor = jsonConvert.convert<String>(json['background_color']);
  if (backgroundColor != null) {
    imageTextNavEntity.backgroundColor = backgroundColor;
  }
  final String? color = jsonConvert.convert<String>(json['color']);
  if (color != null) {
    imageTextNavEntity.color = color;
  }
  final int? count = jsonConvert.convert<int>(json['count']);
  if (count != null) {
    imageTextNavEntity.count = count;
  }
  final String? imageFillStyle = jsonConvert.convert<String>(json['image_fill_style']);
  if (imageFillStyle != null) {
    imageTextNavEntity.imageFillStyle = imageFillStyle;
  }
  final List<ImageTextNavSubEntry>? subEntry = (json['sub_entry'] as List<dynamic>?)?.map((e) => jsonConvert.convert<ImageTextNavSubEntry>(e) as ImageTextNavSubEntry).toList();
  if (subEntry != null) {
    imageTextNavEntity.subEntry = subEntry;
  }
  final String? slideSetting = jsonConvert.convert<String>(json['slide_setting']);
  if (slideSetting != null) {
    imageTextNavEntity.slideSetting = slideSetting;
  }
  final String? uuid = jsonConvert.convert<String>(json['uuid']);
  if (uuid != null) {
    imageTextNavEntity.uuid = uuid;
  }
  return imageTextNavEntity;
}

Map<String, dynamic> $ImageTextNavEntityToJson(ImageTextNavEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['border_width'] = entity.borderWidth;
  data['show_method'] = entity.showMethod;
  data['background_color'] = entity.backgroundColor;
  data['color'] = entity.color;
  data['count'] = entity.count;
  data['image_fill_style'] = entity.imageFillStyle;
  data['sub_entry'] = entity.subEntry?.map((v) => v.toJson()).toList();
  data['slide_setting'] = entity.slideSetting;
  data['uuid'] = entity.uuid;
  return data;
}

extension ImageTextNavEntityExtension on ImageTextNavEntity {
  ImageTextNavEntity copyWith({
    int? borderWidth,
    String? showMethod,
    String? backgroundColor,
    String? color,
    int? count,
    String? imageFillStyle,
    List<ImageTextNavSubEntry>? subEntry,
    String? slideSetting,
    String? uuid,
  }) {
    return ImageTextNavEntity()
      ..borderWidth = borderWidth ?? this.borderWidth
      ..showMethod = showMethod ?? this.showMethod
      ..backgroundColor = backgroundColor ?? this.backgroundColor
      ..color = color ?? this.color
      ..count = count ?? this.count
      ..imageFillStyle = imageFillStyle ?? this.imageFillStyle
      ..subEntry = subEntry ?? this.subEntry
      ..slideSetting = slideSetting ?? this.slideSetting
      ..uuid = uuid ?? this.uuid;
  }
}

ImageTextNavSubEntry $ImageTextNavSubEntryFromJson(Map<String, dynamic> json) {
  final ImageTextNavSubEntry imageTextNavSubEntry = ImageTextNavSubEntry();
  final String? linkType = jsonConvert.convert<String>(json['link_type']);
  if (linkType != null) {
    imageTextNavSubEntry.linkType = linkType;
  }
  final int? imageHeight = jsonConvert.convert<int>(json['image_height']);
  if (imageHeight != null) {
    imageTextNavSubEntry.imageHeight = imageHeight;
  }
  final String? imageUrl = jsonConvert.convert<String>(json['image_url']);
  if (imageUrl != null) {
    imageTextNavSubEntry.imageUrl = imageUrl;
  }
  final String? linkTitle = jsonConvert.convert<String>(json['link_title']);
  if (linkTitle != null) {
    imageTextNavSubEntry.linkTitle = linkTitle;
  }
  final int? imageWidth = jsonConvert.convert<int>(json['image_width']);
  if (imageWidth != null) {
    imageTextNavSubEntry.imageWidth = imageWidth;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    imageTextNavSubEntry.title = title;
  }
  final int? linkId = jsonConvert.convert<int>(json['link_id']);
  if (linkId != null) {
    imageTextNavSubEntry.linkId = linkId;
  }
  return imageTextNavSubEntry;
}

Map<String, dynamic> $ImageTextNavSubEntryToJson(ImageTextNavSubEntry entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['link_type'] = entity.linkType;
  data['image_height'] = entity.imageHeight;
  data['image_url'] = entity.imageUrl;
  data['link_title'] = entity.linkTitle;
  data['image_width'] = entity.imageWidth;
  data['title'] = entity.title;
  data['link_id'] = entity.linkId;
  return data;
}

extension ImageTextNavSubEntryExtension on ImageTextNavSubEntry {
  ImageTextNavSubEntry copyWith({
    String? linkType,
    int? imageHeight,
    String? imageUrl,
    String? linkTitle,
    int? imageWidth,
    String? title,
    int? linkId,
  }) {
    return ImageTextNavSubEntry()
      ..linkType = linkType ?? this.linkType
      ..imageHeight = imageHeight ?? this.imageHeight
      ..imageUrl = imageUrl ?? this.imageUrl
      ..linkTitle = linkTitle ?? this.linkTitle
      ..imageWidth = imageWidth ?? this.imageWidth
      ..title = title ?? this.title
      ..linkId = linkId ?? this.linkId;
  }
}
